name: Release Main Version

on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
      - 'zap/zap.gradle.kts'

jobs:
  release:
    name: Build and Release
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
        persist-credentials: false
    - name: Setup Java
      uses: actions/setup-java@v1
      with:
        java-version: 11
    - name: Build and Release
      env:
        INSTALL4J_LICENSE: ${{ secrets.INSTALL4J_LICENSE }}
        ZAPBOT_TOKEN: ${{ secrets.ZAPBOT_TOKEN }}
      run: ./gradlew "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m" :zap:createMainRelease
